﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FarseerGames.FarseerPhysics.Mathematics;

namespace FreeGoo.LevelClasses.LevelParts
{
    public class OffsetFrameLevelPart : ContainerLevelPart
    {
        public override string Name { get { return "OffsetFrame"; } }
        public override void AddToEngineFromXml(Level level, System.Xml.Linq.XElement element)
        {
            Vector2 offset = element.Attribute("Offset").ToVector2();
                            
            level.PositionOffset += offset;
            try
            {
                base.AddToEngineFromXml(level, element);
            }
            finally
            {
                level.PositionOffset -= offset;
            }
        }
    }
}
